<script type="text/javascript">
 
window.onerror=function(msg, url, linenumber){
 alert('Error message: '+msg+'\nURL: '+url+'\nLine Number: '+linenumber)
 return true
}
</script>
 
<script type="text/javascript">
document.write('hi there'
</script>
 
=======================================================
 
window.onerror=null
	here no function is written, but function is not been written
 
=========================================================
 
<SCRIPT>
 function badImage(theImage) {   
  alert('Error: ' + theImage.name + ' did not load properly.')
 }
</SCRIPT>
<FORM>
 <IMG NAME="imageBad2" SRC="orca.gif" ALIGN="left" BORDER="2" onError="badImage(this)">
</FORM>
 
===============================================================
 

<SCRIPT>
window.onerror = myOnError
msgArray = new Array()
urlArray = new Array()
lnoArray = new Array()

function myOnError(msg, url, lno) {
	msgArray[msgArray.length] = msg
	urlArray[urlArray.length] = url
	lnoArray[lnoArray.length] = lno
	return true
}
function displayErrors() {
	win2 = window.open('', 'window2')
	win2.document.writeln('<B>Error Report</B><P>')
	for ( var i = 0; i < msgArray.length; i++) {
		win2.document.writeln('<B>Error in file:</B> ' + urlArray[i] + '<BR>')
		win2.document.writeln('<B>Line number:</B> ' + lnoArray[i] + '<BR>')
		win2.document.writeln('<B>Message:</B> ' + msgArray[i] + '<P>')
	}
	win2.document.close()
}
</SCRIPT>
<BODY onload="noSuchFunction()">
	<FORM>
		<INPUT TYPE="button" VALUE="This button has a syntax error" onClick="alert('unterminated string)">
		<P><INPUT TYPE="button" VALUE="Display Error Report" onClick="displayErrors()">
	</FORM>
 
 
 
===================================================================== 
 
